from alg import Solution
from gen import generate_test_cases

def run_tests():
    """运行测试用例"""
    solution = Solution()
    test_cases = generate_test_cases()
    
    print("开始测试...\n")
    passed = 0
    total = len(test_cases)
    
    for i, (nums, expected) in enumerate(test_cases, 1):
        result = solution.canJump(nums)
        is_correct = result == expected
        
        print(f"测试用例 {i}:")
        print(f"输入: {nums}")
        print(f"预期输出: {expected}")
        print(f"实际输出: {result}")
        print(f"测试{'通过' if is_correct else '失败'}\n")
        
        if is_correct:
            passed += 1
    
    print(f"测试完成: {passed}/{total} 通过")

if __name__ == "__main__":
    run_tests() 